Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][FIX] pos_order_to_sale_order: rpc helper #1260

Open
wants to merge 1 commit into
base: 16.0
Choose a base branch
from

Conversation

danielduqma
Copy link
Contributor

@danielduqma danielduqma commented Oct 30, 2024

rpc attribute used comes from LegacyComponent, that is deprecated and throws an error in some specific cases. Changing it by this.env.services works properly in all cases.

This can be reproduced executing this from other component:

const create_order = new CreateOrderPopup(props, this.env);
const {sale_order_id} = await create_order._createSaleOrder("draft");

FL-556-4346

`rpc` attribute used comes from LegacyComponent, that is deprecated
and throws an error in some specific cases. Changing it by
`this.env.services` works properly in all cases.
@OCA-git-bot
Copy link
Contributor

Hi @legalsylvain,
some modules you are maintaining are being modified, check this out!

@legalsylvain
Copy link
Contributor

Hi. Do you mean it should be changed in all modules ?

rgrep "this\.rpc" ./ --include=*.js
./pos_order_to_sale_order/static/src/js/CreateOrderPopup.js:            return await this.rpc({
./pos_product_label/static/src/PrintLabelPopup.esm.js:            const data = await this.rpc({
./pos_product_label/static/src/PrintLabelPopup.esm.js:        const response = await this.rpc({
./pos_partner_firstname/static/src/js/PartnerDetailsEdit.js:                this.rpc({
./pos_financial_risk/static/src/js/PaymentScreen.esm.js:            this.rpc({
./pos_order_to_sale_order_delivery/static/src/js/Popups/CreateOrderPopup.esm.js:    const response = await this.rpc({
./pos_partner_location_google_map/static/src/js/PartnerMapGoogleEdit.esm.js:            return this.rpc({
./pos_lot_barcode/static/src/js/Screens/ProductScreen.js:                    foundLotIds = await this.rpc({
./pos_order_to_sale_order_sale_financial_risk/static/src/js/CreateOrderPopup.esm.js:            const [partnerRiskValues] = await this.rpc({
./pos_loyalty_redeem_payment/static/src/js/PaymentScreen.esm.js:                const payload = await this.rpc({

rgrep "this\.env\.services\.rpc" ./ --include=*.js
./pos_lot_selection/static/src/js/models.js:                    return await this.env.services.rpc(
./pos_loyalty_redeem_payment/static/src/js/PaymentScreen.esm.js:            return await this.env.services.rpc({

@danielduqma
Copy link
Contributor Author

Thanks for reviewing! I'm not sure enough and I haven't tested globally, but as I analyzed:

  • CreateOrderPopup extends AbstractAwaitablePopup
  • AbstractAwaitablePopup extends PosComponent
  • PosComponent extends LegacyComponent

The last component is defined here, and it's just a wrapper over owl.Component that mainly adds rpc method for legacy. I think direct use of this rpc is deprecated in some way, and in fact LegacyComponent no longer exists in 17.0 and newer, where those calls are managed by orm service.

So, in our case the code in the main comment leads to an error, but I haven't found any other incompatibilities with the other modules.

Regards

@danielduqma danielduqma marked this pull request as ready for review November 6, 2024 14:33
@danielduqma danielduqma changed the title [FIX] pos_order_to_sale_order: rpc helper [16.0][FIX] pos_order_to_sale_order: rpc helper Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants